﻿<!--<script src="//cdn.bootcss.com/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link rel="stylesheet" href="//cdn.bootcss.com/jqueryui/1.11.0/jquery-ui.min.css">-->
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>查看</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_1467699544_0880156.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/bootstrap3.3.5/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/animate.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/index.css">
    <link rel="stylesheet" type="text/css" href="/ViewV5/CSS/default.css">
    <link href="/ViewV5/JS/raty/jquery.raty.css" rel="stylesheet" />

    <style>
        .object {
            padding: 0.2em;
            border: solid 1px;
            cursor: text;
            background-color: #fff;
        }

        /*.delBut {
            cursor: pointer;
        }*/

        .controlBar {
            border: solid 1px #D2D2D2;
            padding: 2px;
        }

        .ui-resizable-e {
            display: none !important;
        }

        .ui-resizable-s {
            display: none !important;
        }

        .move-kdd {
            width: 120px;
            height: 120px;
            position: fixed;
            /*bottom: 50px;
            right: 150px;*/
            z-index: 100;
            top: 45px;
            left: 470px;
        }

            .move-kdd img {
                width: 100%;
                height: 100%;
                position: absolute;
            }

            .move-kdd a {
                width: 40px;
                height: 40px;
                display: inline-block;
                z-index: 120;
                position: absolute;
                cursor: pointer;
            }

                .move-kdd a span {
                    position: absolute;
                    width: 20px;
                    height: 20px;
                    display: inline-block;
                    display: none;
                }

        .up-key {
            left: 40px;
            top: 0;
        }

        .down-key {
            left: 40px;
            top: 80px;
        }

        .left-key {
            left: 0px;
            top: 40px;
        }

        .right-key {
            left: 80px;
            top: 40px;
        }

        .move-kdd .up-key span {
            top: -20px;
            left: 10px;
        }

        .move-kdd .down-key span {
            top: 40px;
            left: 10px;
        }

        .move-kdd .left-key span {
            top: 10px;
            left: -20px;
        }

        .move-kdd .right-key span {
            top: 10px;
            left: 40px;
        }

        .move-kdd a.dy-key {
            width: 40px;
            height: 40px;
            background: #fff;
            font-size: 14px;
            border-radius: 100%;
            top: 50%;
            left: 50%;
            line-height: 40px;
            text-align: center;
            margin-left: -20px;
            margin-top: -20px;
            font-weight: 700;
        }

        .dy-btn {
            position: fixed;
            bottom: 100px;
            right: 20px;
        }

            .dy-btn input {
                width: 140px;
                height: 35px;
                border-radius: 0;
                display: block;
                margin-bottom: 20px;
            }
        #content {
            display: none;
        }
    </style>
    <script src="/ViewV5/JS/jquery-1.11.2.min.js"></script>
    <script src="/ViewV5/JS/layer/layer.js"></script>
    <script src="/ViewV5/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/ViewV5/JS/avalon1.47.js"></script>
    <script src="/ViewV5/JS/SZHLCommon.js?jsver=20160915"></script>
    <script src="/ViewV5/JS/YSteps/Steps.js"></script>
    <script src="/ViewV5/JS/raty/jquery.raty.js"></script>
    <script>
        var tempindex = avalon.define({
            $id: "W_KDDY",
            name: "快递打印",
            modelData: [],//快递配置数据
            LeiXing: [],//所有配置信息
            curKDType: "",//当前选中的快递
            //send: [],
            //receiver: [],
            pzData: {},//当前选中的快递配置数据
            dyJson: "",//打印记录的json
            dyGS: "",//打印记录的快递
            lxrID: ComFunJS.getQueryString("lxrid"),//客户联系人id
            lxrData: {},//客户联系人信息
            cydzData: { "sendUser": "", "sendTel": "", "sendHomePhone": "", "sendCompany": "", "sendAddress": "", "sendProvince": "", "sendCity": "", "sendCounty": "" },
            InitWigetData: function (strId) {
                if (strId) {//从打印记录中打印
                    $.getJSON('/API/VIEWAPI.ashx?Action=KDDY_GETDYJLMODEL', { P1: strId }, function (resultData) {
                        if (resultData.ErrorMsg == "") {
                            tempindex.dyJson = resultData.Result.Info;
                            tempindex.dyGS = resultData.Result.GongSi;
                            $.getJSON('/API/VIEWAPI.ashx?Action=KDDY_GETPZALL', function (Data) {
                                if (resultData.ErrorMsg == "") {
                                    tempindex.LeiXing = Data.Result;
                                    tempindex.changeKD(tempindex.dyGS);
                                }
                            })
                        }
                    })
                }
                else {
                    if (tempindex.lxrID) {
                        $.getJSON('/API/VIEWAPI.ashx?Action=CRM_GETKHLXRMODEL', { P1: tempindex.lxrID }, function (result) {
                            if (result.ErrorMsg == "") {
                                tempindex.lxrData = result.Result;
                                tempindex.lxrData.KHName = result.Result1;

                                $.getJSON('/API/VIEWAPI.ashx?Action=KDDY_GETPZALL', function (resultData) {
                                    if (resultData.ErrorMsg == "") {
                                        tempindex.LeiXing = resultData.Result;
                                        if (tempindex.LeiXing.size() > 0) {
                                            tempindex.changeKD(resultData.Result[0].ID);
                                        }
                                    }
                                })
                            }
                        })
                    }
                    else {
                        $.getJSON('/API/VIEWAPI.ashx?Action=KDDY_GETPZALL', function (resultData) {
                            if (resultData.ErrorMsg == "") {
                                tempindex.LeiXing = resultData.Result;
                                if (tempindex.LeiXing.size() > 0) {
                                    tempindex.changeKD(resultData.Result[0].ID);
                                }
                            }
                        })
                    }
                }
                ComFunJS.initForm();
            },//初始化
            Add: function () {//编辑配置
                top.ComFunJS.winviewform("/ViewV5/AppPage/APP_ADD_WF.html?FormCode=KDDY_KDPZ&ID=" + tempindex.curKDType, '添加表单', "1200", "");
            },
            AddNew: function () {//新增快递配置
                top.ComFunJS.winviewform("/ViewV5/AppPage/APP_ADD_WF.html?FormCode=KDDY_KDPZ", '添加表单', "1200", "");
            },
            SaveData: function (callback) {
                //tempindex.modelData.forEach(function (el) {
                //    el.text = $("#" + el.name).val();
                //})
                if (tempindex.curKDType) {
                    var dys = buildTemplate();
                    //if ($("#czyd").val() * 1) {//垂直移动
                    //    if ($("input[name='cz']:checked").val() * 1 > 0) {
                    //        tempindex.pzData.Vertical = -$("#czyd").val() * 1;//上移
                    //    }
                    //    else {
                    //        tempindex.pzData.Vertical = $("#czyd").val() * 1;//下移
                    //    }
                    //}
                    //else {
                    //    tempindex.pzData.Vertical = 0;
                    //}
                    //if ($("#spyd").val() * 1) {//水平移动
                    //    if ($("input[name='sp']:checked").val() * 1 > 0) {
                    //        tempindex.pzData.Horizontal = -$("#spyd").val() * 1;//左移
                    //    }
                    //    else {
                    //        tempindex.pzData.Horizontal = $("#spyd").val() * 1;//右移
                    //    }
                    //}
                    //else {
                    //    tempindex.pzData.Horizontal = 0;
                    //}
                    tempindex.cydzData.sendUser = $("#sendUser").find(".vl").text();
                    tempindex.cydzData.sendTel = $("#sendTel").find(".vl").text();
                    tempindex.cydzData.sendHomePhone = $("#sendHomePhone").find(".vl").text();
                    tempindex.cydzData.sendCompany = $("#sendCompany").find(".vl").text();
                    tempindex.cydzData.sendAddress = $("#sendAddress").find(".vl").text();
                    tempindex.cydzData.sendProvince = $("#sendProvince").find(".vl").text();
                    tempindex.cydzData.sendCity = $("#sendCity").find(".vl").text();
                    tempindex.cydzData.sendCounty = $("#sendCounty").find(".vl").text();
                    //新增地址
                    $.post("/API/VIEWAPI.ashx?ACTION=KDDY_ADDCYDZ", { P1: JSON.stringify(tempindex.cydzData) }, function (result) {
                        var jsonresult = $.parseJSON(result)
                        if (jsonresult.ErrorMsg == "") {
                        }
                    });
                    //新增打印记录
                    $.post("/API/VIEWAPI.ashx?ACTION=KDDY_ADDDYJL", { P1: dys, P2: tempindex.curKDType, Vertical: tempindex.pzData.Vertical, Horizontal: tempindex.pzData.Horizontal }, function (result) {
                        var jsonresult = $.parseJSON(result)
                        if (jsonresult.ErrorMsg == "") {
                            tempindex.LeiXing.forEach(function (item) {
                                if (item.ID == tempindex.curKDType) {
                                    item.objects = buildTemplatePZ();
                                }
                            })
                        }
                    });

                    //var headstr = "<html><head><title></title></head><body>";
                    //var footstr = "</body>";
                    //var newstr = document.getElementById("content").innerHTML;
                    //var oldstr = document.body.innerHTML;
                    //document.body.innerHTML = headstr+newstr+footstr;
                    //window.print();
                    //document.body.innerHTML = oldstr;
                    //return false;
                    //打印
                    var cz = 0;
                    var sp = 0;
                    if (tempindex.pzData.Vertical * 1) {
                        cz = tempindex.pzData.Vertical * 3.78;
                    }
                    if (tempindex.pzData.Horizontal * 1) {
                        sp = tempindex.pzData.Horizontal * 3.78;
                    }
                    var oPop = window.open('', 'oPop');
                    var str = '<!DOCTYPE html>'
                    str += '<html>'
                    str += '<head>'
                    str += '<meta charset="utf-8">'
                    str += '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">'
                    str += '</head>'
                    str += '<body style="position: relative;top: ' + (cz - 60) + 'px;left:' + (sp - 70) + 'px;">'
                    str += document.getElementById("content").innerHTML
                    str += '</body>'
                    str += '</html>'
                    var str1 = '<!DOCTYPE html>'
                    str1 += '<html>'
                    str1 += '<head>'
                    str1 += '<meta charset="utf-8">'
                    str1 += '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">'
                    str1 += '</head>'
                    str1 += '<body >'
                    str1 += document.getElementById("content").innerHTML
                    str1 += '</body>'
                    str1 += '</html>'

                    oPop.document.write(str);
                    oPop.print();
                    oPop.document.write(str1);
                    //oPop.close();
                }

            },
            changeKD: function (id) {
                $(".object").remove();//清除输入框
                printObjects = [];//清除输入框对象
                $("input[type='radio']").removeAttr('checked');//移除移动radio的选中状态
                tempindex.curKDType = id;//当前选中的快递
                tempindex.modelData = [];//清除快递配置数据
                //tempindex.send = [];
                //tempindex.receiver = [];
                tempindex.LeiXing.forEach(function (item) {
                    if (item.ID == tempindex.curKDType) {//当前选中的快递
                        tempindex.pzData = item;//当前选中的快递配置数据赋值
                      
                        if (tempindex.dyGS == item.ID) {//打印记录的json赋值给当前快递的配置json
                            tempindex.modelData = JSON.parse(tempindex.dyJson);
                        }
                        else {
                            //当前快递的配置json新增title并赋值
                            var data = JSON.parse(item.objects);
                            data.forEach(function (el) {
                                el.title = el.text;
                                el.text = "";
                            })
                            tempindex.modelData = data;
                        }
                        tempindex.modelData.forEach(function (i) {
                            if (i.name.indexOf('receiver') != -1) {
                                //tempindex.receiver.push(i);
                                if (tempindex.lxrData.UserXM) {
                                    if (i.name == 'receiverUser') {
                                        i.text = tempindex.lxrData.UserXM;
                                    }
                                    if (i.name == 'receiverTel') {
                                        i.text = tempindex.lxrData.TelePhone;
                                    }
                                    if (i.name == 'receiverHomePhone') {
                                        i.text = tempindex.lxrData.MobilePhone;
                                    }
                                    if (i.name == 'receiverAddress') {
                                        i.text = tempindex.lxrData.Address;
                                    }
                                    if (i.name == 'receiverCompany') {
                                        i.text = tempindex.lxrData.KHName;
                                    }
                                }
                            }
                            //当前登录人员赋值给快递发送信息
                            if (i.name.indexOf('send') != -1) {
                                if (tempindex.dyGS != item.ID) {
                                    if (i.name == 'sendUser') {
                                        i.text = top.model.UserData.UserRealName;
                                    }
                                    if (i.name == 'sendTel') {
                                        i.text = top.model.UserData.mobphone;
                                    }
                                    if (i.name == 'sendAddress') {
                                        i.text = top.model.CompanyData.Address;
                                    }
                                    if (i.name == 'sendCompany') {
                                        i.text = top.model.CompanyData.QYName;
                                    }
                                }
                                //tempindex.send.push(i);
                            }
                        })
                        tempindex.pzData.objects = JSON.stringify(tempindex.modelData);

                        //initContent(tempindex.pzData);
                    }
                });
            },
            xzcydz: function () {
                top.ComFunJS.winbtnwin("/ViewV5/AppPage/KDDY/XZCYDZLIST.html", "选择寄件人", "1000", "600", {}, function (layero, index) {
                    var frameid = $("iframe", $(layero)).attr('id');
                    var getcydz = ComFunJS.isIE() ? top.window.frames[frameid].getcydz() : window.frames[frameid].contentWindow.getcydz();

                    if (getcydz) {
                        $("#sendUser").find(".vl").text(getcydz.sendUser);
                        $("#sendTel").find(".vl").text(getcydz.sendTel);
                        $("#sendHomePhone").find(".vl").text(getcydz.sendHomePhone);
                        $("#sendCompany").find(".vl").text(getcydz.sendCompany);
                        $("#sendAddress").find(".vl").text(getcydz.sendAddress);
                        $("#sendProvince").find(".vl").text(getcydz.sendProvince);
                        $("#sendCity").find(".vl").text(getcydz.sendCity);
                        $("#sendCounty").find(".vl").text(getcydz.sendCounty);

                        top.layer.close(index);
                    }

                });
            },
            xzlxr: function () {
                top.ComFunJS.winbtnwin("/ViewV5/AppPage/CRM/XZLXRLIST.html", "选择联系人", "1000", "600", {}, function (layero, index) {
                    var frameid = $("iframe", $(layero)).attr('id');
                    var getlxr = ComFunJS.isIE() ? top.window.frames[frameid].getlxr() : window.frames[frameid].contentWindow.getlxr();

                    if (getlxr) {
                        $("#receiverUser").find(".vl").text(getlxr.UserXM);
                        $("#receiverTel").find(".vl").text(getlxr.TelePhone);
                        $("#receiverHomePhone").find(".vl").text(getlxr.MobilePhone);
                        $("#receiverAddress").find(".vl").text(getlxr.Address);
                        $("#receiverCompany").find(".vl").text(getlxr.KHName);

                        top.layer.close(index);
                    }

                });
            },
            showyd: function (event) {
                if (event.stopPropagation) {
                    event.stopPropagation();
                }
                if ($(".move-kdd").is(":hidden")) {
                    $(".move-kdd").show();
                }
                else {
                    $(".move-kdd").hide();
                }
            },
            move: function (type) {
                if (!tempindex.pzData.Vertical) { tempindex.pzData.Vertical = '0'; }
                if (!tempindex.pzData.Horizontal) { tempindex.pzData.Horizontal = '0'; }
                switch (type) {
                    case 1: tempindex.pzData.Vertical = tempindex.pzData.Vertical * 1 - 1; break;
                    case 2: tempindex.pzData.Vertical = tempindex.pzData.Vertical * 1 + 1; break;
                    case 3: tempindex.pzData.Horizontal = tempindex.pzData.Horizontal * 1 - 1; break;
                    case 4: tempindex.pzData.Horizontal = tempindex.pzData.Horizontal * 1 + 1; break;
                }

                $(this).find('span').show();
                $(this).find('span').addClass("animated");
                setTimeout("$('.move-kdd').find('span').hide();", 500);
            },
            tplj: function (str) {
                if (str.indexOf('office') > 0) {
                    return 'url(' + str + ')';
                }
                else {
                    return 'url(/ViewV5/Base/DownFile.aspx?fileId=' + str + ')';
                }
            }
        });
        avalon.ready(function () {
            tempindex.InitWigetData(ComFunJS.getQueryString("ID"));
        })

        var printObjects = [];//输入框对象集合

        ///给打印内容对象添加参数
        function addPrintObjects(data, id, text) {
            if (data.w == null) {
                data.w = 'auto';
            }
            if (data.h == null) {
                data.h = 'auto';
            }
            if (data.top == null) {
                data.top = 0;
            }
            if (data.left == null) {
                data.left = 0;
            }
            if (data.name == null) {
                data.name = id;
            }
            if (data.text == null) {
                data.text = text;
            }
            if (data.font_size == null) {
                data.font_size = tempmodel.modelData.FontSize;
            }
            if (data.font_family == null) {
                data.font_family = tempmodel.modelData.Font;
            }
            if (data.title == null) {
                data.title = tempmodel.modelData.title;
            }
            var object = new PrintObject(data, $('#content'));
            printObjects.push(object);
        }

        //加载快递公司配置开始
        function initContent(templateData) {
            if (templateData != null) {
                if (templateData.objects && templateData.objects.length > 0) {
                    var objects = JSON.parse(templateData.objects);
                    if (objects != null && objects.length > 0) {
                        for (var k = 0; k < objects.length; k++) {
                            //$('#' + objects[k].name).removeAttr("checked").click();
                            if (printObjects != null && printObjects.length > 0) {
                                for (var i = 0; i < printObjects.length; i++) {
                                    if (printObjects[i].id == objects[k].name) {
                                        var tempObj = printObjects[i];
                                        tempObj.remove();
                                        printObjects.splice(i, 1);
                                        tempObj = null;
                                        break;
                                    }
                                }
                            }
                            addPrintObjects(objects[k], objects[k].name, objects[k].text);
                        }
                    }
                }
                templateData = null;
            } else {
                templateData = null;
            }
        }
        //组合打印json
        function buildTemplate() {
            var str = "";
            var params = [];
            $("#xscontent .object").each(function () {
                var obj = $(this);
                var paramObj = {};
                paramObj.name = obj.attr("id");
                paramObj.title = obj.attr("title");
                paramObj.text = obj.find(".vl").text();
                paramObj.w = obj.css("width").replace('px', '');
                paramObj.h = obj.css("height").replace('px', '');
                paramObj.top = obj.css("top").replace('px', '');
                paramObj.left = obj.css("left").replace('px', '');
                paramObj.font_size = obj.css("font-size");
                paramObj.font_weight = obj.css("font-weight");
                paramObj.font_family = obj.css("font-family");

                params.push(paramObj);

                $("#content .object").each(function () {
                    var obj1 = $(this);
                    if (obj.attr("title") == obj1.attr("title")) {
                        obj1.find(".vl").text(obj.find(".vl").text());
                    }
                })
            })

            if (params.length > 0) {
                str = JSON.stringify(params);
            }
            return str;
        }
        //组合配置json
        function buildTemplatePZ() {
            var str = "";
            var params = [];
            $(".object").each(function () {
                var obj = $(this);
                var paramObj = {};
                paramObj.name = obj.attr("id");
                paramObj.text = obj.attr("title");
                paramObj.w = obj.css("width").replace('px', '');
                paramObj.h = obj.css("height").replace('px', '');
                paramObj.top = obj.css("top").replace('px', '');
                paramObj.left = obj.css("left").replace('px', '');
                paramObj.font_size = obj.css("font-size");
                paramObj.font_weight = obj.css("font-weight");
                paramObj.font_family = obj.css("font-family");

                params.push(paramObj);
            })

            if (params.length > 0) {
                str = JSON.stringify(params);
            }
            return str;
        }
        //输入框对象
        var PrintObject = function (data, container) {
            //类方法
            if (typeof PrintObject._initialized == "undefined") {

                PrintObject.prototype.html = function (useIdValue) {
                    var html = '<div  id="' + this.id + '" title="' + this.title + '" class="object" ' + (true != this.resized ? 'data-w="auto"' : '') +
                               'style="' + (true != this.resized ? 'width:auto;height:auto' : 'width:' + this.w + ';height:' + this.h) + ';top:' + this.top + ';left:' + this.left + ';position:absolute;' +
                               'font-size:' + this['font-size'] + ';font-weight:' + this['font-weight'] + ';font-family:' + this['font-family'] + ';text-align:left;"><div contenteditable="true" style="min-height:' + (this.h.substring(0, this.h.length - 2) * 1 - 8) + 'px" class="vl">' +

                               ((useIdValue && this.id.indexOf('custom') == -1) ? '{{>' + this.id.replace('Check', '') + '}}' : this.text) + '</div>';

                    if (this.id == "receiverUser") {
                        html = html + '<div style="position: absolute;cursor: pointer;right: -25px;  top: 5px;"><i class="fa fa-user"></i></div>';
                    }
                    html = html + '</div>';

                    return html;
                };

                PrintObject.prototype.toPx = function (val) {
                    val = val + "";
                    if (val != null && val.indexOf('px') == -1 && val != 'auto') {
                        val = val + 'px';
                    }
                    return val;
                }
            }
            PrintObject._initialized = true;
            //类方法定义结束
            var obj = this;
            this.id = data.name;
            this.text = data.text;
            this.title = data.title;
            this.w = this.toPx(data.w);
            this.h = this.toPx(data.h);
            if (this.w != 'auto') {
                this.resized = true;
            }
            this.top = this.toPx(data.top);
            this.left = this.toPx(data.left);

            this['font-size'] = data.font_size != null ? data.font_size : '12px';
            this['font-weight'] = data.font_weight != null ? data.font_weight : 'normal';
            this['font-family'] = data.font_family != null ? data.font_family : '新宋体';
            if (container != null) {
                this.parent = container;
                this.el = $(this.html());
                this.parent.append(this.el);
                this.el.draggable({
                    drag: function () {
                        //$('#objectSetting').hide();
                    }
                }).resizable({
                    minHeight: 10, minWidth: 50, stop: function () {
                        obj.resized = true;
                    }
                }).click(function () {
                    $(this).draggable({ disabled: true });
                    $(this).css('opacity', '1');
                    $(this).trigger("mousedown");
                    if ($(this).css("min-height") == "0px") {
                        $(this).css('min-height', $(this).height() - 8);
                        $(this).css('height', 'auto');
                    }
                }).mouseout(function () {
                    $(this).draggable({ disabled: false });
                });//拖动，编辑

                this.el.mousedown(function () {

                })
                this.el.mouseup(function () {

                    obj.mousedowned = false;
                    obj.moveed = false;
                    obj.top = ($(obj.el).offset().top - $(obj.parent).offset().top + $(obj.parent).scrollTop()) + 'px';
                    obj.left = ($(obj.el).offset().left - $(obj.parent).offset().left + $(obj.parent).scrollLeft()) + 'px';
                    obj.w = $(obj.el).width() + 'px';
                    obj.h = $(obj.el).height() + 'px';
                })
                this.el.mousemove(function () {
                    if (obj.mousedowned != null && obj.mousedowned) obj.moveed = true;
                })
                this.el.find(".fa-user").click(function () {
                    top.ComFunJS.winbtnwin("/ViewV5/AppPage/APPLIST.html?FormCode=CRM_XZLXR", "选择联系人", "1000", "600", {}, function (layero, index) {
                        var frameid = $("iframe", $(layero)).attr('id');
                        var getlxr = ComFunJS.isIE() ? top.window.frames[frameid].getlxr() : window.frames[frameid].contentWindow.getlxr();

                        if (getlxr) {
                            $("#receiverUser").find(".vl").text(getlxr.UserXM);
                            $("#receiverTel").find(".vl").text(getlxr.TelePhone);
                            $("#receiverHomePhone").find(".vl").text(getlxr.MobilePhone);
                            $("#receiverAddress").find(".vl").text(getlxr.Address);
                            $("#receiverCompany").find(".vl").text(getlxr.KHName);

                            top.layer.close(index);
                        }

                    });
                })
            }

            return obj;
        }

        $(function () {
            $(document).on("click", ".form-horizontal", function () {
                $(".move-kdd").hide();
            });
        })
        //# sourceURL=KDDY.js;
    </script>
</head>

<body style="background-color: #F8F8F8; height: 100%;" ms-controller="W_KDDY">
    <div class="nav-right" style="margin-left: 0">
        <div class="form-horizontal">
            <div class="form-group" style="margin:0px;">
                <div class="col-xs-12" style="padding-left:485px; margin-top: 10px;">
                    <div class="btn-group">
                        <button class="btn btn-white" type="button" ms-click="showyd()">调整位置</button>
                        <button class="btn btn-primary" type="button" ms-click="SaveData()">打印</button>
                    </div>
                </div>
                <div class="col-xs-12" id="xscontent" style="margin-top: 10px; overflow: auto;  ">
                    <div id="expressImg" style="width: 1100px; background-size: 1100px;" ms-css-height="Math.round((pzData.imageHeight * 1.0 / pzData.imageWidth * 1.0) * 1100)+'px'" ms-css-background-image="tplj(pzData.KDImg)">
                        <div ms-repeat-item="modelData" ms-attr-id="item.name" ms-attr-title="item.title" ms-css-width="item.w+'px'" ms-css-height="item.h+'px'" class="object"
                             ms-css-top="item.top+'px'" ms-css-left="item.left+'px'" ms-css-font-size="item.font_size" ms-css-font-weight="item.font_weight" ms-css-font-family="item.font_family"
                             style="position: absolute; text-align: left; ">
                            <div contenteditable="true" class="vl" style="width:100%;height:100%;">{{item.text}}</div>
                            <div ms-if="item.name=='receiverUser' " style="position: absolute;cursor: pointer;right: -25px;  top: 5px;"><i class="iconfont icon-rencopy" ms-click="xzlxr()" style="color:blue;"></i></div>
                            <div ms-if="item.name=='sendUser' " style="position: absolute;cursor: pointer;right: -25px;  top: 5px;"><i class="iconfont icon-rencopy" ms-click="xzcydz()" style="color:blue;"></i></div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12" id="content">
                    <div ms-css-width="pzData.imageWidth* 3.78+'px'" ms-css-height="pzData.imageHeight* 3.78+'px'"
                         ms-css-background-image="tplj(pzData.KDImg)">
                        <div ms-repeat-item="modelData" ms-attr-id="item.name+'1'" ms-attr-title="item.title" ms-css-width="item.w+'px'" ms-css-height="item.h+'px'" class="object"
                             ms-css-top="Math.round((pzData.imageWidth * 3.78 /1100 ) * item.top)+'px'" ms-css-left="Math.round((pzData.imageWidth * 3.78 /1100 ) * item.left)+'px'" ms-css-font-size="item.font_size" ms-css-font-weight="item.font_weight" ms-css-font-family="item.font_family"
                             style="position: absolute; text-align: left;">
                            <div contenteditable="true" class="vl" style="width:100%;height:100%;">{{item.text}}</div>
                            <div ms-if="item.name=='receiverUser' " style="position: absolute;cursor: pointer;right: -25px;  top: 5px;"><i class="iconfont icon-rencopy" ms-click="xzlxr()" style="color:blue;"></i></div>
                            <div ms-if="item.name=='sendUser' " style="position: absolute;cursor: pointer;right: -25px;  top: 5px;"><i class="iconfont icon-rencopy" ms-click="xzcydz()" style="color:blue;"></i></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="move-kdd" style="display:none;">
            <img src="/images/an.png" />
            <a href="javascript:void(0);" ms-attr-title="pzData.Vertical=='0'?'0':((pzData.Vertical*1>0?'下移'+pzData.Vertical:'上移'+(-pzData.Vertical*1))+'mm')" class="up-key" ms-click="move(1)"><span>+1</span></a>
            <a href="javascript:void(0);" ms-attr-title="pzData.Horizontal=='0'?'0':((pzData.Horizontal*1>0?'右移'+pzData.Horizontal:'左移'+(-pzData.Horizontal*1))+'mm')" class="right-key" ms-click="move(4)"><span>+1</span></a>
            <a href="javascript:void(0);" ms-attr-title="pzData.Vertical=='0'?'0':((pzData.Vertical*1>0?'下移'+pzData.Vertical:'上移'+(-pzData.Vertical*1))+'mm')" class="down-key" ms-click="move(2)"><span>+1</span></a>
            <a href="javascript:void(0);" ms-attr-title="pzData.Horizontal=='0'?'0':((pzData.Horizontal*1>0?'右移'+pzData.Horizontal:'左移'+(-pzData.Horizontal*1))+'mm')" class="left-key" ms-click="move(3)"><span>+1</span></a>
            <!--<a href="javascript:void(0);" class="dy-key" ms-click="SaveData()">打印</a>-->
        </div>

    </div>
</body>